<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page language="java" import="java.util.*"%>
<%@ page language="java" import="com.hospital.util.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<link href="images/main.css" rel="stylesheet" type="text/css" />
<link  href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/trim.js"></script>
<script language="javascript" type="text/javascript" src="../My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
	function sub(){
		var ypmc = document.getElementById("ypmc");
		if(ypmc.value == '1029'){
			ypsl.value = 0;
			document.forms["form"].submit();
		}else{
			document.forms["form"].submit();
		}
	}
</script>
</head>
<body onload="init();">
	<jsp:include page="right_top.jsp"></jsp:include>
		<%
		String message = (String)request.getAttribute("message");
		if(message == null){
			message = "";
		}
		if (!message.trim().equals("")){
			out.println("<script language='javascript'>");
			out.println("alert('"+message+"');");
			out.println("</script>");
		}
		request.removeAttribute("message");
	%>
	<!-- TOP START -->
	<div id="right_font">
		<img src="images/main_14.gif" /> 您现在所在的位置：首页 &rarr; 住院病情管理 &rarr; <span
			class="bfont">填写住院病情</span>
	</div>
	<!-- TOP END -->
	<hr >
	<form action="InhospitalCureServlet?method=add" method="post" name="form" id="form">
	<% 
		String orderid = "inhospital"+DateUtil.getDateTime("yyyyMMddHHmmss");
	%>
		<table style="margin-top: 30px;">
			<tr height="30px;">
				<td><font color="#FF0000">*</font>挂号编码：</td>
				<td><%=orderid %></td>
				<td width="220px;"><input type="hidden" value=<%=orderid %> id="orderid"/></td>
			</tr>
			<tr height="30px;">
				<td><font color="#FF0000">*</font>病患姓名：</td>
				<td>
				<select name="account" id="account">
				<% 
				//添加进入病房Id号码
				String sqlpatient = "select * from t_patient_info where Inhospitable = 'yes' and sickbedId != 'null'";
				List<Map<String, Object>> listpatient = DbUtil.find(sqlpatient);
				if(listpatient.size()>0){
					Map<String, Object> mappatient = null;
					for (int i = 0; i < listpatient.size(); i++) {
						mappatient = (Map<String, Object>)listpatient.get(i);
				%>
					<option value="<%=mappatient.get("account")%>"><%=mappatient.get("account") %></option>
				<%} %>
				</select>
				</td>
				<td>&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td><font color="#FF0000">*</font>病&nbsp;&nbsp;情：</td>
				<td>
				<textarea rows="8" cols="35" name="cases" id="cases" style=" font-size:13px;"></textarea>
				<!-- <input type="text" name="cases" id="cases" maxlength="25" /> -->
				</td>
				<td>&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td><font color="#FF0000">*</font>药物名称：</td>
				<td>
				<select name="ypmc" id="ypmc">
					<% 
						//添加进入t_medicinename中的Id号码
						String sql = "select * from t_medicinename";
						List<Map<String, Object>> list = DbUtil.find(sql);
						Map<String, Object> map = null;
						for (int i = 0; i < list.size(); i++) {
							map = (Map<String, Object>)list.get(i);
					%>
						<option value="<%=map.get("id")%>"><%=map.get("mname") %></option>
					<% 
						}
					%>
				</select>
				</td>
				<td>&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td><font color="#FF0000">*</font>药品数量：</td>
				<td><input type="text" name="ypsl" id="ypsl" maxlength="12" /></td>
				<td>&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td><font color="#FF0000">*</font>检查项目名称：</td>
				<td>
				<select name="item" id="item">
					<% 
						String sqlitem = "select * from t_checklist";
						List<Map<String, Object>> listitem = DbUtil.find(sqlitem);
						Map<String, Object> mapitem = null;
						for (int i = 0; i < listitem.size(); i++) {
							mapitem = (Map<String, Object>)listitem.get(i);
					%>
						<option value="<%=mapitem.get("id")%>"><%=mapitem.get("name") %></option>
					<% 
						}
					%>
				</select>
				</td>
				<td>&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td colspan="2" align="center">
					&nbsp;<input type="hidden" name="orderid" value="<%=orderid %>" /> 
				</td>
				<td>&nbsp;</td>
			</tr>
			
			<tr height="30px;">
				<td colspan="2" align="center">
					<input type="button" value="提交" onclick="sub();"/>&nbsp;&nbsp;
					<input type="button" value="返回" onclick="history.go(-1);" />
				</td>
				<td>&nbsp;</td>
			</tr>
		</table>
	</form>
				<% 
				}else{
				%>
				<option value="">没有需要添加住院病情的病患</option>
				</select>
				</td>
				<td>&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td colspan="2" align="center">
					<input type="button" value="返回" onclick="history.go(-1);"/>
				</td>
				<td>&nbsp;</td>
			</tr>
			</table>
				<%} %>
				
</body>
</html>